<?php

/*
 * Elaboraco Por: Ebrain Cedeno.
 */

class TLabel{
    
    public $Align;
    public $Name;
    public $Width='';
    public $Height='';
    public $Visible = true;
    public $WordWrap;
    public $Caption;
    public $Color;
    public $Cursor;
    public $Font;
    public $FontColor;
    public $Top;
    public $Left;
    public $adicional = array();
    
    
    public function show(){
        
        $visible = ($this->Visible == false)?'display:none; visibility:hidden;':'';
        $width = ($this->Width != "")?'width:'.$this->Width."; ":'';
        $height = ($this->Height != "")?'height:'.$this->Height."; ":'';
        $color = ($this->Color != "")?'background-color:'.$this->Color.";":'';
        $align = ($this->Align != "")?'text-align:'.$this->Align.";":'';
        $cursor = ($this->Cursor != "")?'cursor:'.$this->Cursor.';':'';
        $top = ($this->Top != "")?'position:absolute; top:'.$this->Top.';':'';
        $left = ($this->Left != "")?'position:absolute; left:'.$this->Left.';':'';
        $font = ($this->Font != "")?'font:'.$this->Font.';':'';
        $fontColor = ($this->FontColor != "")?'color:'.$this->FontColor.';':'';
        
        $adicional_style ="";
        $adicional_parameter = "";
        
        //cargando parametros adicionales a label
        
        if (count($this->adicional) > 0){
            foreach ($this->adicional as $llave=>$value){
                if (strtolower($llave) != "style"){
                    if (strtolower($llave) != "id"){
                        $adicional_parameter .= $llave.'="'.$value.'" ';
                    }
                }
                else{
                    $adicional_style = implode(";", $value);
                }
            }
        }
        
        $label = '<div id="'.$this->Name.'" style="'.$width.$height.$color.$font.$fontColor.$top.$left.$cursor.$align.$visible.$adicional_style.'" '.$adicional_parameter.'>'.$this->Caption.'</div>';
        
        return $label;
    }
    
}

?>
